<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="java.util.List,com.sp.scmdb.entity.Menu,com.sp.scmdb.entity.Role" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><s:property value='%{getText("menu_title")}' /></title>
<link href="/SCMDB/style/main.css" rel="stylesheet" type="text/css" />
<link href="/SCMDB/style/left.css" rel="stylesheet" type="text/css" />
<link href="/SCMDB/style/dtree.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/SCMDB/js/dtree.js"></script>
<script type="text/javascript" src="/SCMDB/js/Super.js"></script>
</head>
<body>
<div class="m_left">  
  <div class="user"> <img src="/SCMDB/images/user.gif" />
    <p><s:property value="#session.user.userName"/><span> <s:property value='%{getText("menu_spa")}' /><a href="javascript:if(confirm('确实要登出系统吗?')) location='/SCMDB/loginAction!logout.action'" target="_top" class="out" title="退出系统"><s:property value='%{getText("menu_out")}' /></a></span></p>
  </div>
 <script type="text/javascript"> 
 	
		   d = new dTree('d');
		   d.add(0,-1,'系统菜单');
		   <%
		   
			List<Menu> list = (List<Menu>)session.getAttribute("menus");
			Menu menu = null;
			int id = 1;
			int pId = 0;
			int sId = 0;
			for (int i = 0; i < list.size(); i++){
				menu = list.get(i);
				if (1 == menu.getLevel()) {					
				%>
					d.add(<%=id%>, 0,'<%=menu.getCdesc()%>','','<%=menu.getCdesc()%>','','<%=menu.getRmk()%>','<%=menu.getRmk()%>');
				<%
					id++;    // 一级菜单的时候id增加1
					pId++;   // 父id增加1
					sId = 0; // 子Id置0
				}else if (2 == menu.getLevel()){%>
					d.add(<%=(pId + "0" + sId)%>, <%=pId%>, '<%=menu.getCdesc()%>', '<%=menu.getRmk()%>', '<%=menu.getCdesc()%>', 'main');
				<%  
				sId++; // 二级菜单的时候子id增加1
				}
			}%>
		   document.write(d);
	</script>
</div>
</body>
</html>
